#define catelog()
<div class="layui-row">
  <div class="layui-col-md12">
    <fieldset class="layui-elem-field layui-field-title">
      <legend>分类列表</legend>
    </fieldset>
    <div class="layui-box">
      <div class="layui-row layui-col-space10" id="catelog">
        <center><i style="font-weight: bold;font-size: 26px;" class="layui-icon layui-anim layui-anim-rotate layui-anim-loop">&#xe63d;</i></center>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$(function () {
  // 获取分类
  $.get('/api/catelog/list', function(ret) {
    var domNode = $('#catelog');
    if (ret.state == 'ok') {
      domNode.html(null);
      for (var i = 0; i < ret.count; i++) {
        addCatelogItem(i+1, ret.data[i], domNode);
      }
    } else {
      domNode.html(ret.msg);
    }
  });
});
function addCatelogItem(index, data, domNode) {
  var html = '<div class="layui-elip"><a href="/catelog/'+data.id+'" class="cate-li"><i class="layui-btn layui-btn-mini list-icon">'+ index +'</i>' + data.name + '</a></div>';
  domNode.append(html);
}
</script>
#end
